<%@ page contentType="text/html;charset=UTF-8"%>
<!--底部-->
<footer class="m-foot">
	<div class="g-box ctn-mn">
		<div class="m-ct-hd">
			<div class="hd-inner">
				<h1 class="hd-tt"><span>呼唤我们</span></h1>
				<div><i></i><img src="${ctx}/image/favicon.ico" alt=""><i></i></div>
			</div>
		</div>
		<div class="footer-ctn">
			<div class="foot-l l">
				<div class="foot-b">
					<span class="iconfont icon-service"></span>
					<div class="foot-t">
						<p>咨询热线</p>
						<p>4008-771-663</p>
					</div>
				</div>
				<div class="foot-b">
					<span class="iconfont icon-location"></span>
					<div class="foot-t">
						<p>公司地址</p>
						<p>深圳市南山区粤海街道软件产业基地5栋C座2层3B</p>
					</div>
				</div>
			</div>
			<div class="foot-r r">
				<div class="qr-ctn">
					<img src="${ctx}/image/gzhqr_big_code.png" alt="">
					<p>同行者公众号</p>
				</div>
				<div class="qr-ctn">
					<img src="${ctx}/image/k-qrcode.png" alt="">
					<p>客服微信</p>
				</div>
			</div>
			<div class="clearfix"></div>
			<div class="copy-r">
				<p><a class="white" href="http://www.miitbeian.gov.cn" target="_blank">粤ICP备16040064号-1</a></p>
				<p>深圳前海同行者咨询有限公司©版权所有</p>
			</div>
		</div>
	</div>
</footer>
<!--留言联系-->
<div class="m-msg">
	<i class="iconfont icon-close"></i>
	<p class="tt">留言</p>
	<div class="msg-ctn">
		<form id="msgForm" class="layui-form mt20" method="post" action="${ctx}/gatherForm/form/save.do">
			<input name="id" type="hidden" value="formData.id"/>
			<div class="layui-form-item name">
				<input type="hidden" name="infoItems[0].fieldId"/>
				<input type="hidden" name="infoItems[0].sort" />
				<input type="text" name="infoItems[0].fieldValue" lay-verify="name" autocomplete="off" placeholder="怎么称呼您？" class="layui-input" value="">
			</div>
			<div class="layui-form-item phone">
				<input type="hidden" name="infoItems[1].fieldId"/>
				<input type="hidden" name="infoItems[1].sort" />
				<input type="text" name="infoItems[1].fieldValue" lay-verify="phone" autocomplete="off" placeholder="如何联系您？（手机、座机、邮箱）" class="layui-input" value="">
			</div>
			<div class="layui-form-item msg">
				<input type="hidden" name="infoItems[2].fieldId"/>
				<input type="hidden" name="infoItems[2].sort" />
				<textarea name="infoItems[2].fieldValue" placeholder="写下您想咨询的服务、您想提供的宝贵意见……" lay-verify="msg" class="layui-textarea"></textarea>
			</div>
			<a href="javascript:void(0)" style="width: 120px;" class="layui-btn layui-btn-danger" lay-submit lay-filter="msg-form">提交</a>
		</form>
	</div>
</div>
<script>
    $(function(){
        var form, layer, msgLayIndex;
        layui.use(['layer'], function () {
            layer = layui.layer;
        })
		$('.m-msg .icon-close').click(function (e) {
            layer.close(msgLayIndex)
        })
        $('#msg_btn').click(function (e) {
            //自定页
            msgLayIndex = layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                area: ['500px', '380px'],
                shadeClose: true,
                skin: 'layui-msg',
                content: $('.m-msg')
            });
        })
        layui.use(['form'], function () {
            form = layui.form;
            form.verify({
                name: function (value) {
                    if(!value){
                        return '怎么称呼您？';
					}
                },
				phone: function (value) {
                    if(!value){
                        return '如何联系您？';
                    }
                },
                msg: function (value) {
                    if(!value){
                        return '写下您想咨询的服务、您想提供的宝贵意见……';
                    }
                }
            });
            //监听提交
            form.on('submit(msg-form)', function (data) {
                $(data.elem).removeAttr("lay-submit");
                var params = util.serializeForm($('#msgForm').serializeArray());
                var action = $("#msgForm").attr("action");
                txz.ajaxRequest({
                    method: 'post',
                    url: action,
                    params: params,
                    callBack: function (res) {
                        if (res.success) {
                            util.layerMsgSuccess("提交成功")
                            layer.close(msgLayIndex)
                            $(data.elem).attr("lay-submit", "");
                            $('#msgForm input[type=text]').val('')
                            $('#msgForm textarea').val('')
                        } else {
                            util.layerMsgError("提交失败")
                            $(data.elem).attr("lay-submit", "");
                        }
                    }
                });
            });
        });
        txz.ajaxRequest({
			url: '${ctx}/gatherForm/project/getDetails.do',
			params: {
			    projectId: '5e0b403b04624fddbdb87d71bc3f1895'
			},
			callBack: function (ret) {
			    var items = ret.data.items
				$('#msgForm input[name=id]').val('5e0b403b04624fddbdb87d71bc3f1895')
				$('#msgForm .layui-form-item.name input:nth-child(1)').val(items[0].id)
				$('#msgForm .layui-form-item.name input:nth-child(2)').val(items[0].sort)
                $('#msgForm .layui-form-item.phone input:nth-child(1)').val(items[1].id)
                $('#msgForm .layui-form-item.phone input:nth-child(2)').val(items[1].sort)
                $('#msgForm .layui-form-item.msg input:nth-child(1)').val(items[2].id)
                $('#msgForm .layui-form-item.msg input:nth-child(2)').val(items[2].sort)
				console.log(ret)
            }
		})
    })
</script>